import { NgModule } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LayoutComponent } from './components/layout/layout.component';
import { ManageLayoutComponent } from './components/manage-layout/manage-layout.component';
import { RouterModule } from '@angular/router';
import {
    PERFECT_SCROLLBAR_CONFIG,
    PerfectScrollbarConfigInterface,
    PerfectScrollbarModule
} from 'ngx-perfect-scrollbar';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { FileUploadModule } from 'ng2-file-upload';
import { ConfigModule } from './config.module';
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
import { LoadingBarModule } from '@ngx-loading-bar/core';
import { NgxsModule } from '@ngxs/store';
import { LottieModule } from 'ngx-lottie';
import player from 'lottie-web';
import { InterceptorService } from './services/Interceptor.service';
import { ImportComponent } from './components/import/import.component';
import { NgxPermissionsModule } from 'ngx-permissions';
import { PermissionsResolve } from './guards/permissions.resolve';
import { TreeSelectComponent } from './components/select/tree-select/tree-select.component';
import { ImportButtonComponent } from './components/import-button/import-button.component';
import { NgxEchartsModule } from 'ngx-echarts';
import * as echarts from 'echarts';
import { UploadFileComponent } from './components/upload-file/upload-file.component';
import { UploadUpdateFileComponent } from './components/upload-update-file/upload-update-file.component';
import { SafaWorkingTimePip } from './common/pip/myPip.service';
import { NgZorroModule } from './ng-zorro.module';
import { UserLoginComponent } from './components/user-login/user-login.component';
import { IframePageComponent } from './components/iframe-page/iframe-page.component';
import { SvgShowComponent } from './components/svg/svg-show/svg-show.component';
import { ImageUploadFileComponent } from './components/image-upload-file/image-upload-file.component';
import { UserRegisterComponent } from './components/user-register/user-register.component';
import { SelectTreeComponent } from './components/tree/select-tree/select-tree.component';
import { CheckTreeComponent } from './components/tree/check-tree/check-tree.component';
import { EditTreeComponent } from './components/tree/edit-tree/edit-tree.component';
import { TableComponent } from './components/table/table.component';
import { SvgEditorComponent } from './components/svg/svg-editor/svg-editor.component';
import { MainTableComponent } from './components/nested-table/main-table/main-table.component';
import { SubTableComponent } from './components/nested-table/sub-table/sub-table.component';
import { DocumentEditorModule } from '@onlyoffice/document-editor-angular';
import { OnlyofficeComponent } from './components/onlyoffice/onlyoffice.component';
import { CountdownComponent } from './components/countdown/countdown.component';
import { Time1Component } from './components/time/time1.component';
import { Time2Component } from './components/time/time2.component';
import { AngularEditorComponent, AngularEditorModule } from '@kolkov/angular-editor';
import { MyEditorComponent } from './components/my-editor/my-editor.component';
import { MyCkEditorComponent } from './components/my-editor/my-ck-editor/my-ck-editor.component';
import { MyAngularEditorComponent } from './components/my-editor/my-angular-editor/my-angular-editor.component';
import { NzRateModule } from 'ng-zorro-antd/rate';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { NgIconModule } from './icon/ng-icon.module';
import { DictSelectComponent } from './components/select/dict-select/dict-select.component';
import { NormalSelectComponent } from './components/select/normal-select/normal-select.component';
import { IconSelectTableComponent } from './components/icon/icon-select-table/icon-select-table.component';
import { DictLabelComponent } from './components/dict-label/dict-label.component';
import { JsonFormatPipe } from './common/pip/json-format.pipe';
import { SafeHtmlPipe } from './common/pip/safa-html.pipe';
import { JsonFoldingComponent } from './components/json-folding/json-folding.component';

export function playerFactory() {
    return player;
}
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
    suppressScrollX: true
};

@NgModule({
    declarations: [
        LayoutComponent,
        ManageLayoutComponent,
        ImportComponent,
        TreeSelectComponent,
        ImportButtonComponent,
        UploadFileComponent,
        UploadUpdateFileComponent,
        SafaWorkingTimePip,
        JsonFormatPipe,
        UserLoginComponent,
        IframePageComponent,
        SvgShowComponent,
        SafeHtmlPipe,
        ImageUploadFileComponent,
        SelectTreeComponent,
        CheckTreeComponent,
        UserRegisterComponent,
        EditTreeComponent,
        TableComponent,
        MainTableComponent,
        SubTableComponent,
        SvgEditorComponent,
        OnlyofficeComponent,
        CountdownComponent,
        Time1Component,
        Time2Component,
        MyEditorComponent,
        MyCkEditorComponent,
        MyAngularEditorComponent,
        DictSelectComponent,
        NormalSelectComponent,
        IconSelectTableComponent,
        DictLabelComponent,
        JsonFoldingComponent,
    ],
    imports: [
        CommonModule,
        HttpClientModule,
        FormsModule,
        ConfigModule,
        ReactiveFormsModule,
        RouterModule,
        FileUploadModule,
        DocumentEditorModule,
        LottieModule.forRoot({ player: playerFactory }),
        PerfectScrollbarModule,
        LoadingBarRouterModule,
        LoadingBarModule,
        NgxPermissionsModule.forRoot(),
        NgxEchartsModule.forRoot({ echarts }),
        NgZorroModule,
        AngularEditorModule,
        NzRateModule,
        CKEditorModule,
        NgIconModule,
    ],
    providers: [
        PermissionsResolve,
        DatePipe,
        { provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true },
        {
            provide: PERFECT_SCROLLBAR_CONFIG,
            useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
        }
    ],
    exports: [
        TreeSelectComponent,
        ReactiveFormsModule,
        RouterModule,
        HttpClientModule,
        FormsModule,
        NgxsModule,
        LottieModule,
        PerfectScrollbarModule,
        FileUploadModule,
        LoadingBarRouterModule,
        LoadingBarModule,
        NgxPermissionsModule,
        ImportComponent,
        ImportButtonComponent,
        UploadFileComponent,
        UploadUpdateFileComponent,
        SafaWorkingTimePip,
        NgZorroModule,
        UserLoginComponent,
        IframePageComponent,
        SvgShowComponent,
        ImageUploadFileComponent,
        SelectTreeComponent,
        EditTreeComponent,
        TableComponent,
        MainTableComponent,
        SubTableComponent,
        SvgEditorComponent,
        LayoutComponent,
        OnlyofficeComponent,
        CountdownComponent,
        Time1Component,
        Time2Component,
        MyEditorComponent,
        MyCkEditorComponent,
        MyAngularEditorComponent,
        AngularEditorComponent,
        DictSelectComponent,
        NormalSelectComponent,
        CheckTreeComponent,
        IconSelectTableComponent,
        DictLabelComponent,
        JsonFormatPipe,
        SafeHtmlPipe,
        JsonFoldingComponent,
    ]
})
export class    ShareModule {}
